/**
 * @param {number[]} nums
 * @return {number[]}
*/
var sortedSquares = function(nums) {
  nums.sort((a, b) => Math.abs(a) - Math.abs(b));
  nums = nums.map((item) => {
    return item * item;
  });
  return nums;
};
let nums = [-4,-1,0,3,10];
console.log(sortedSquares(nums));
nums = [-7,-3,2,3,11];
console.log(sortedSquares(nums));
